package com.xxl.job.kettle.core.service;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xxl.job.kettle.core.entity.KRepository;
import com.xxl.job.kettle.core.entity.TreeDTO;
import org.pentaho.di.repository.RepositoryObjectType;

import java.util.List;
import java.util.Map;

/**
 * 实现功能：
 *
 * @author 作者[zk]
 * @version 1.0.00  2022-11-27 10:47
 */
public interface KRepositoryService extends BaseService<KRepository>{

    /**
     * 测试连接
     * @param repository
     */
    void testConnection(KRepository repository);

    List<String> selectAllRep();

    KRepository getRepositoryDetail(String id);

    List<KRepository> findRepList();

    TreeDTO<String> findRepTreeById(String id, RepositoryObjectType objectType) throws Exception;

    List<TreeDTO<String>> findTransRepTreegridById(String id, String dirPath) throws Exception;

    List<TreeDTO<String>> initTransRep(String id, String dirPath) throws Exception;

    JSONArray getDatabasesByRepId(String id) throws Exception;

    /**
     * 新增资源库
     * @param repository
     */
    void add(KRepository repository);

    /**
     * 删除资源库
     * @param id
     */
    void delete(String id);

    /**
     * 批量删除
     * @param ids
     */
    void deleteBatch(List<String> ids);

    void update(KRepository repository);

    IPage<KRepository> findRepListByPage(Map<String, Object> params);

    String createRepository(JSONObject jsonObject) throws Exception;
}
